import request from '@/utils/request'
import { url_name } from "@/axios/Global";

// export function signIn(data) {
//     return request({
//         url: `${url_name}/oauth/token?grant_type=password&username=${data.userName}&password=${data.passWord}&client_secret=secret&client_id=${url_name_3}`,
//         method: 'post',
//     })
// }
// 登录
export function signIn(data) {
    return request({
        url: `${url_name}/login`,
        method: 'post',
        data
    })
}

// 注册
export function register(data) {
    return request({
        url: `${url_name}/register`,
        method: 'post',
        data
    })
}

// 更新用户信息
export function updateUser(data) {
    return request({
        url: `${url_name}/updateUser`,
        method: 'post',
        data
    })
}

// 自动登录
export function autoLoginByToken(data) {
    return request({
        url: `${url_name}/autoLoginByToken`,
        method: 'post',
        data
    })
}

// 登出
export function signOut(data) {
    return request({
        url: `${url_name}/loginOut`,
        method: 'GET',
    })
}

// 获取菜单
export function getMenuLists(data) {
    return request({
        url: `${url_name}/getMenuLists`,
        method: 'post',
        data
    })
}

export function autoLogin(data) {
    return request({
        url: `${url_name}/autoLogin`,
        method: 'post',
        data
    })
}

export function updateUserInfo(data) {
    return request({
        url: `${url_name}/updateUserInfo`,
        method: 'post',
        data
    })
}

export function getUserList(data) {
    return request({
        url: `${url_name}/getUserList`,
        method: 'post',
        data
    })
}

export function saveMenu(data) {
    return request({
        url: `${url_name}/saveMenu`,
        method: 'post',
        data
    })
}

export function updateMenu(data) {
    return request({
        url: `${url_name}/updateMenu`,
        method: 'post',
        data
    })
}

export function deleteMenu(data) {
    return request({
        url: `${url_name}/deleteMenu`,
        method: 'post',
        data
    })
}

export function saveAuth(data) {
    return request({
        url: `${url_name}/saveAuth`,
        method: 'post',
        data
    })
}

export function getAuthLists(data) {
    return request({
        url: `${url_name}/getAuthLists`,
        method: 'post',
        data
    })
}

export function getRoleLists(data) {
    return request({
        url: `${url_name}/getRoleLists`,
        method: 'post',
        data
    })
}

export function getRoleDetailById(data) {
    return request({
        url: `${url_name}/getRoleDetailById`,
        method: 'post',
        data
    })
}

export function saveRole(data) {
    return request({
        url: `${url_name}/saveRole`,
        method: 'post',
        data
    })
}

export function updateRole(data) {
    return request({
        url: `${url_name}/updateRole`,
        method: 'post',
        data
    })
}

export function deleteRole(id) {
    return request({
        url: `${url_name}/deleteRole?id=${id}`,
        method: 'get',
    })
}

export function getAuthTree(data) {
    return request({
        url: `${url_name}/getAuthTree`,
        method: 'post',
        data
    })
}

export function saveRoleAuth(data) {
    return request({
        url: `${url_name}/saveRoleAuth`,
        method: 'post',
        data
    })
}



// 获取用户信息
export function getUserInfo() {
    return request({
        url: `${url_name}/getUserInfo`,
        method: 'GET',
    })
}
